<?php

define('OPEN_EMAIL_SMTP', true);
define('OPEN_EMAIL_SAE', true);

require_once dirname(__FILE__) . '/loadphplib.php';
require_once dirname(__FILE__) . '/stat.function.php';

$arrUsers = array(
    'think667788@sina.com',
        #'think889977@yeah.net',
);

$arrHezuoUsers = array(
    'think667788@sina.com',
        #'think889977@yeah.net',
);

$CSVs = glob(dirname(__FILE__) . '/input/oricsv/7day_*.csv');
$arrCsvKeys = array();

foreach ($CSVs as $csv) {
    $arrCsvNameInfo = explode('_', basename($csv));
    $intK = $arrCsvNameInfo[1];
	$iK = str_replace('.csv','',$intK);
    $arrCsvKeys[$iK] = $intK;
}
krsort($arrCsvKeys,SORT_NUMERIC);
$max=0;
foreach($arrCsvKeys as $k=>$v){
	$max=$k;
	break;
}


for ($i = 1; $i <= 3; $i++) {
    #echo dirname(__FILE__) . '/input/oricsv/7day_'.$arrCsvKeys[$i-1];die();
    @unlink(dirname(__FILE__) . '/input/csv/7day_' . $i . '.csv');
	FCheckDir(dirname(__FILE__) . '/input/csv/7day_' . $i . '.csv');
    copy(dirname(__FILE__) . '/input/oricsv/7day_' . $arrCsvKeys[$max-$i+1], dirname(__FILE__) . '/input/csv/7day_' . $i . '.csv');
	copy(dirname(__FILE__) . '/input/oricsv/30day_' . $arrCsvKeys[$max-$i+1], dirname(__FILE__) . '/input/csv/30day_' . $i . '.csv');
    log::n('copy:' . dirname(__FILE__) . '/input/oricsv/7day_' . $arrCsvKeys[$max-$i+1] . ' to ' . dirname(__FILE__) . '/input/csv/7day_' . $i . '.csv');
}
?>